<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div id="bentrai">
  <div id="main-content">
      <div class="product-detail">
          <div class="facebook-like">
            <div class="fb-like" data-href="<?php echo $this->Html->url(array('controller'=>'san-pham','action'=>'chi-tiet', $content['Product']['id'] . '-' . $content['Product']['alias'], 'ext'=>'html'), true); ?>" data-send="true" data-width="450" data-show-faces="true"></div>
          </div>
          <h3><?php echo $content['Product']['title']; ?></h3>

          <div class="product-information">
              <div class="product-detail-img">
                  <div class="product-detail-img-layer"></div>
                  <a style="z-index: 1;" target="blank" id="product-detail-slideshow-gallery" href="<?php echo $product_image_thumb_url_path . $content['Product']['images']; ?>"><img src="<?php echo $product_image_thumb_url_path . $content['Product']['images']; ?>" /></a>
                  <?php if(isset($product_photos[0])): ?>
                  <ul class="product-detail-gallery">
                      <?php 
                      $i = 1;
                      foreach ($product_photos AS $photo):
                        $large_img    =   $product_gallery_thumb_url_path . $photo['Productphoto']['folder_url'] . $photo['Productphoto']['images'];
                        $small_img    =   $product_gallery_thumb_url_path . $photo['Productphoto']['folder_url'] . $photo['Productphoto']['image_small'];

                      ?>
                        <li>
                            <a small_img="<?php  echo $small_img; ?>" large_img="<?php  echo $large_img; ?>" href="javascript:void(0);"><?php echo $i; ?></a>
                            <img style="display:none;" src="<?php  echo $small_img; ?>" />
                            <img style="display:none;" src="<?php  echo  $large_img; ?>" />
                        </li>
                      <?php
                        $i++;
                        endforeach;
                     ?>
                        <li style="display:none;"><a small_img="<?php echo $product_image_thumb_url_path . $content['Product']['images']; ?>" large_img="<?php echo $product_image_thumb_url_path . $content['Product']['images']; ?>" href="javascript:void(0);">default</a></li>
                  </ul>
                  <?php endif; ?>
              </div>
              <div class="product-detail-info">
                  <p>
                      <span class="label">Mã sản phẩm</span>:
                      <span class="value"><?php echo $content['Product']['product_code']; ?></span>
                  </p>
                  <?php if(!empty($content['Product']['price_promotion'])): ?>
                  <p>
                      <span class="label">Giá bán</span>:
                      <span class="value"><em><del><?php echo $content['Product']['price']; ?> VNĐ</del></em></span>
                  </p>                  
                  <p>
                      <span class="label">Giá khuyến mãi </span>:
                      <span class="value"><?php echo $content['Product']['price_promotion']; ?> VNĐ (<?php echo $content['Product']['price_promotion_percent']; ?>% OFF)</span>
                  </p>
                  <?php endif; ?>
                  <?php if(empty($content['Product']['price_promotion'])): ?>
                  <p>
                      <span class="label">Giá bán</span>:
                      <span class="value"><?php echo $content['Product']['price']; ?> VNĐ</span>
                  </p>
                  <?php endif; ?>
                  <p>
                      <span class="label">Bảo hành</span>:
                      <span class="value"><?php echo $content['Product']['warrant_time']; ?></span>
                  </p>
                  <p>
                      <span class="label">Quà tặng kèm theo</span>:
                      <span class="value"><?php echo $content['Product']['gift_content']; ?></span>
                  </p>
                  <p>
                      <span class="label">Size hiện có của sản phẩm này</span>:
                      <span class="value"><?php echo $content['Product']['product_size']; ?></span>
                  </p>
                  <p>
                      <span class="label">Các mẫu size có sẵn</span>:
                      <span class="value"><a href="/san-pham/size-san-pham.html" target="blank"><img alt="Show sizes" src="/img/size.gif"></a></span>
                  </p>
                  <p>
                      <span class="label">Tên nhãn hiệu</span>:
                      <span class="value"><?php echo $content['Product']['brand_name']; ?></span>
                  </p>
                  <p>
                      <span class="label">Nơi sản xuất </span>:
                      <span class="value"><?php echo $content['Product']['producer']; ?></span>
                  </p>
                  <p>
                      <span class="label">Số người đã đặt mua sản phẩm </span>:
                      <span class="value"><?php echo $content['Product']['view_times']; ?></span>
                  </p>
                  <p>
                      <span class="label">Xem thêm thông tin</span>:
                      <span class="value">
                          <a href="/san-pham/thong-tin-them/<?php echo $content['Product']['id']; ?>-<?php echo $content['Product']['alias']; ?>.html">
                            <img align="absmiddle" style="cursor: hand" alt="Thông tin" src="/img/thongtin.gif">
                          </a>
                            <img width="30px" height="30px" src="/img/hinhthongtin.gif">
                      </span>
                  </p>
              </div>
          </div>
          <div class="product-buy-guild">
              <h2 class="product-buy-guild-title">Cách thức giao hàng</h2>
              <?php echo $content['Product']['buy_description']; ?>
          </div>
          <form id="frmShopcart" name="frmShopcart" action="/gio-hang/them-san-pham.html" method="post">
          <div class="product-add-cart">
            <a onclick="$('#frmShopcart').submit();" href="javascript:void(0);"><img src="/img/giohang.gif" alt="add to cart"/></a>
          </div>
          <input type="hidden" name="product_id" value="<?php echo $content['Product']['id']; ?>" />
          <input type="hidden" name="product_cart_id" value="<?php echo $content['Product']['id']; ?>" />
          <input type="hidden" name="product_name" value="<?php echo $content['Product']['title']; ?>" />
          <?php if($content['Product']['is_promotion']){ ?>
          <input type="hidden" name="price" value="<?php echo $content['Product']['price_promotion']; ?>" />
          <?php }else{ ?>
          <input type="hidden" name="price" value="<?php echo $content['Product']['price']; ?>" />
          <?php } ?>
          <input type="hidden" name="thumbnail" value="<?php echo $product_image_thumb_url_path . $content['Product']['thumbnail']; ?>" />
          <input type="hidden" name="url" value="/san-pham/chi-tiet/<?php echo $content['Product']['id']; ?>-<?php echo $content['Product']['alias']; ?>" />
          <input type="hidden" name="quantity" value="1" />
          </form>
      </div>
      <p class="cachra"></p>
        <?php if(!$login_status): ?>
        <h3 class="no-comment">Đăng nhập để bình luận sản phẩm này</h3>
        <?php endif; ?>
        <?php if($login_status): ?>
        <?php echo $this->Form->create('Comment', array('name'=>'frmComment', 'id'=>'frmComment','class'=>'blockInfo','url'=> array('controller'=>'comments', 'action'=>'post'))); ?>
        <div class="binhluantin">
            	<span class="binhluantinnay">Bình luận Sản phẩm này:</span>
                <div class="nguoibinhluan">
                	<img height="100" width="100" src="<?php echo $user['User']['avatar']; ?>"><br>
                	<span class="tennguoibinh"><?php echo $user['User']['name']; ?></span>
                </div>
                <span class="loibinh">
                        <?php echo $this->Form->input('content', array('rows'=>'1', 'cols'=>'1','value'=>'', 'id'=>'loibinh', 'type'=>'textarea', 'label'=>false, 'div'=> false)); ?>
                    <input type="submit" value="Đăng" name="dang" id="dang">
                </span>
       </div>
         <?php echo $this->Form->hidden('module', array('value'=>'products')); ?>
        <?php echo $this->Form->hidden('module_unique_id', array('value'=>$request_id)); ?>
        <?php echo $this->Form->end(); ?>
        <p class="cachra"></p>
       <?php endif; ?>
       <?php if(isset($data_comments[0])): ?>
        <div class="tongloibinhluan">
            <strong class="tongloibinh"><?php echo $total; ?> lời bình luận</strong>
        </div>
        <p class="cachra"></p>
        <div class="duoibinhluan">
            <?php foreach($data_comments AS $row): ?>
            <div class="duoibinhluan2">
                <img height="50" width="50" src="<?php echo $row['User']['avatar']; ?>">
                <strong class="tennguoibinh1"><?php echo $row['User']['name']; ?></strong>
                <p class="loibinhluan"><?php echo $row['Comment']['content']; ?></p>
            </div>
            <p class="gachngang1"></p>
            <?php endforeach; ?>
        </div>
        <?php echo $this->element('paging', array('paging'=>$this->Paginator));?>
        <?php endif; ?>
  </div>
</div>
